(function(){var validationApp = angular.module('login', []);
// create angular controller
	validationApp.controller('loginController', ['$scope','$http',function($scope,$http) {
		$scope.ValidateUser = function(LogUsername ,Password){
			$.post('ValidateUserUsernameAndPassword',
					{ Username : LogUsername,
					  Password : Password }
			// check the answer, if the username exists take the user to the main page
					).then(function(response) {
            	
            	if (response == "Success")
            	{
            		$("#errAlert").hide();
            		window.location = '\main.html';
            	}
            	else
        		{
            		// show alert message, if the user didnt close the alert
            		// message, after 10 seconds it will be closed
            		$("#errAlert").show();
            		setTimeout(function(){
            			$("#errAlert").hide();;
            		}, 3000);
        		}
            });
		},

		  function(returnedData){
				console.log(returnedData);
				};
		
			
		$scope.reset = function() {
			$scope.Username = '';
			$scope.Password='';
	        
	      };
	}]);
})();/**
 * 
 */